#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib,urllib2,re,os,cookielib,xbmc,xbmcgui

#author:
#gonzoman
#http://www.xbmc.de/xbmc/e107_plugins/forum/forum_viewtopic.php?28116.135

def check(url):
	if url.rfind("quickload"): 
		return 1
	else:
		return 0

def get_regexp():
	return "(http://quickload.to/\?Go\=Player\&HashID\=FILE[0-9a-zA-Z]*)"
def get_name():
	return "quickload"
def join(id):
	return id
	
def get_link1(url):
	#url = str(url)+ "#"
	BASE_PATH = os.getcwd().replace( ";", "" )
	BASE_DATA_PATH = os.path.join( xbmc.translatePath("special://profile/plugin_data/hoster"), "oracle2" )

	req = urllib2.Request(url)
	req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2')
	response = urllib2.urlopen(req)
	page=response.read()
	response.close()

	try:
	    if "67DABFBF-D0AB-41fa-9C46-CC0F21721616" in page:
		link = re.compile('src="(http://[^"]*)" type="video/divx"/>').findall(page)[0]
		print "STREAMURL " +str(link)
		return ("got",link,'','','','','quickload')   

	except:
		return ("fail",'','','','','','quickload')
	
def get_link2(param,code):
		return ("got",param,'','','','','quickload')
